/*

Copyright (c) 2007 David Lambert

This file is part of Factory.

Factory is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Factory is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Factory; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

$Source: /cvsroot/projectfactory/development/net/sourceforge/projectfactory/server/actions/Step.java,v $
$Revision: 1.9 $
$Date: 2007/01/31 23:58:53 $
$Author: ddlamb_2000 $

*/

package net.sourceforge.projectfactory.server.actions;

import net.sourceforge.projectfactory.server.entities.BaseEntity;
import net.sourceforge.projectfactory.xml.WriterXML;
import net.sourceforge.projectfactory.xml.server.TransactionXML;

/** 
  * Defines a Step, which is an item attached to an action.
  * Generated by David Lambert
  * On Tuesday, January 30, 2007 11:12:42 PM CET
  * Using Factory 0.4.8.5
  */
public class Step extends BaseEntity {
    public int level;
    public String name;
    public int complexity;
    public int actionStatus;

    /** Writes the object as an XML output. */
    public void xmlOut(WriterXML xml, TransactionXML transaction, boolean tags) {
        if (tags) xmlStart(xml, "step");
        super.xmlOut(xml, transaction, false);
        if (transaction.isDetail() || transaction.isSave()) {
            xmlAttribute(xml, "level", level);
            xmlAttribute(xml, "name", name);
            xmlAttribute(xml, "complexity", complexity);
            xmlAttribute(xml, "actionstatus", actionStatus);
        }
        if (tags) xmlEnd(xml);
    }

    /** Reads the object from an XML input. */
    public boolean xmlIn(WriterXML xml, TransactionXML transaction, String tag, String value) {
        if (super.xmlIn(xml, transaction, tag, value)) return true;
        if (tag.equals("level")) {
            level = xmlInInt(xml, value);
            return true;
        }
        if (tag.equals("name")) {
            name = value;
            return true;
        }
        if (tag.equals("complexity")) {
            complexity = xmlInInt(xml, value);
            return true;
        }
        if (tag.equals("actionstatus")) {
            actionStatus = xmlInInt(xml, value);
            return true;
        }
        return false;
    }
}
